﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace LSHoude.Console.UnitTests
{
    [TestClass]
    public class ProgressBarunitTest
    {
        [TestMethod]
        public void ProgressInPercentageOver100()
        {
            try
            {
                ProgressBar progressBar = new ProgressBar();
                progressBar.ProgressInPercentage = 101;
            }
            catch(Exception e)
            {
                Assert.IsInstanceOfType(e, typeof(ArgumentException));
            }
        }

        [TestMethod]
        public void ProgressInPercentageUnder0()
        {
            try
            {
                ProgressBar progressBar = new ProgressBar();
                progressBar.ProgressInPercentage = -1;
            }
            catch (Exception e)
            {
                Assert.IsInstanceOfType(e, typeof(ArgumentException));
            }
        }

        [TestMethod]
        public void ProgressInPercentageEdges()
        {
            ProgressBar progressBar = new ProgressBar();
            progressBar.ProgressInPercentage = 0;
            progressBar.ProgressInPercentage = 50;
            Assert.AreEqual(progressBar.ProgressInPercentage, 50);
            progressBar.ProgressInPercentage = 100;
        }
    }
}
